<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>终端录入</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/a.css"/>" type="text/css"
	rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css"

	rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　


　　　
</style>

<script type="text/javascript">

	$(document).ready(function(){
				$("#terminalDiv").click(function(){
				
						var table=$("#istable").get(0);
					    var count=$("#count").val();
						var lengths=table.rows.length;
						if(lengths > count*4+2){
							return false;
						}
						
				     var a=""
				     +"<tr><td align='right' width='20%'>门店名称：</td><td align='left'><input type='text' maxlength='50' class='someWidth' name='termBeanList["+parseInt(lengths/4)+"].termName'/></td><td align='right' width='20%'>终端类型：</td><td align='left'><select class='someWidth' name='termBeanList["+parseInt(lengths/4)+"].tidKind'><option value='01'>有线</option><option value='02'>无线</option></select></td><td> <input type='button' onclick='deleteRows(this)' value='删除' /></td></tr>"
				     +"<tr><td align='right' width='20%'>终端安装地址：</td><td colspan='4' align='left'><input type='text' maxlength='50' class='someWidth' name='termBeanList["+parseInt(lengths/4)+"].termAddress'/></td></tr>"
				     +"<tr><td align='right' width='20%'>备注：</td><td colspan='4' align='left'><input type='text' maxlength='65'  class='someWidth'  name='termBeanList["+parseInt(lengths/4)+"].termNote'/></td></tr>"
				     +"<tr><td colspan='5'>&nbsp;</td></tr>"
				     +"";
				     $("#istable").append(a);
				     return false;
				});
				
				$("#delTr").click(function(){
					var tb=document.getElementById("istable");
				    var lengths=tb.rows.length;
				    
				    if(lengths > 7){
					    tb.deleteRow(lengths-1);
					    tb.deleteRow(lengths-2);
					    tb.deleteRow(lengths-3);
					    tb.deleteRow(lengths-4);
					    tb.deleteRow(lengths-5);
				    }
				    
				    return false;
				});
				
				$("#submitTer").click(function(){
					var sdf=1;
					$("input[type='text']").each(function () {
	                    if ($(this).val() == "") {
	                        sdf=0;
	                    }
	                })
	                if(sdf == 0){
	                alert("请将信息填写完整！");
	               		 return false;
	                }
	                if(confirm("确认添加终端")){
					     return true;
					}
				    return false;
				});
				
				$("#backBtn").click(function(){
			       self.history.back(1);
			       return false;
			    });
			}
	);

    function deleteRows(input){
		var a=input.parentNode.parentNode.rowIndex;
		var table=$("#istable").get(0);
		
		table.deleteRow(a+3);//删除
		table.deleteRow(a+2);
		table.deleteRow(a+1);
		table.deleteRow(a);
		
	}
</script>



</head>

<body>

	<div class="subpage">
		<s:form id="queryUserForm" action="/terminal/queryTerminalApplySave.ct" method="post"
			theme="simple">
			<s:hidden name="termapply.merchantNo" value="%{termapply.merchantNo}"/>
			<s:hidden name="termapply.id" value="%{termapply.id}"/>
			<s:hidden id="count" name="count" value="%{termapply.count}"/>
			<div class="user_title">
	    		 <h2 class="headline-inquires">POS收单运营管理平台<br />
	    		 <span class="sub-title">

	    		 </span></h2>
	    		</div>
			<table id="istable" width="100%" cellpadding="0" cellspacing="0" border="0"
				class="table">

				<tr>
					<td colspan="5" align="center">
						<h2 class="headline-inquires">
							终端录入<br />
							<span class="sub-title"></span>
						</h2>

					</td>
				</tr>


				<tr>
					<td colspan="5">&nbsp;</td>
				</tr>
				
				<tr>
					<td align="right" width="20%">门店名称：</td>
					<td align="left"><input type="text" maxlength="50" class="someWidth"  name="termBeanList[0].termName"/></td>
					<td align="right" width="20%">终端类型：</td>
					<td align="left"><select  class="someWidth"  name="termBeanList[0].tidKind"><option value="01">有线</option><option value="02">无线</option></select></td>
				    <td> <input type="button" id="terminalDiv" value="添加" /></td>
				</tr>
				<tr>
					
				</tr>
				<tr>
					<td align="right" width="20%">终端安装地址：</td>
					<td align="left" colspan="4"><input type="text" maxlength="50"  class="someWidth"  name="termBeanList[0].termAddress"/></td>
					
				</tr>
				<tr>
					<td align="right" width="20%">备注：</td>
					<td align="left" colspan="4"><input type="text" maxlength="65"  class="someWidth"  name="termBeanList[0].termNote"/></td>
				</tr>
				<tr>
					<td colspan="5">&nbsp;</td>
					<%------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --%>
				</tr>
				</table>
				
				<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="table">
				<tr>
						<td colspan="2" align="center"><span style="font-color: red"><s:actionerror /></span>
							<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
									cssClass="fieldError" /></span>
							<span id="otherError"></span>
						</td>
					</tr>
				<tr>
					<td colspan="2" align="right"><s:submit id="submitTer" value="确定" />
						&nbsp;&nbsp;&nbsp;&nbsp; <s:reset value="取  消" />&nbsp;&nbsp;&nbsp;&nbsp; 
						<s:submit id="backBtn" value="返  回" ></s:submit></td>
				</tr>
				

				<tr>
					<td colspan="2">&nbsp;</td>
				</tr>
			</table>
			
		</s:form>
	</div>
	<s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>
